<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ko">
<head>
<title>애니메이션 효과 적용</title>
<meta name="class-lists" content="jindo.Slider"/>
<meta name="screenshots" content=""/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="description" content="Thumb 이 이동할 때 부드럽게 이동하도록 수정한 예제입니다.">
<link rel="stylesheet" type="text/css" href="../asset/demo.css">
<style type="text/css">
	.slider {
		background:#eee url(img/Slider.grid.gif) no-repeat 5px bottom; position:relative;
		width:211px; height:40px;
	}
	
	.slider .slider-thumb {
		background:url(img/Slider.thumb.gif) no-repeat;
		position:absolute; width:11px; height:21px; overflow:hidden;
		left:0px;
		cursor:default;
	}
</style>
</head>
<body>
<script type="text/javascript" src="../asset/demojs/demo.js#header"
     data-title="Jindo Component"
     data-subtitle="=document.title"
     data-backbutton="false"
     data-viewsource="false"
     data-qrcode="true"></script>
	
<div class="demo">
	<div class="slider" id="beta">
		<div class="slider-thumb">&nbsp;</div>
	</div>
</div>

<script type="text/javascript" charset="utf-8" src="../../asset/jindo.desktop.all.ns.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.Component.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.UIComponent.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.Timer.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.Effect.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.Transition.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.DragArea.js"></script>
<script type="text/javascript" charset="utf-8" src="../../source/jindo.Slider.js"></script>
<script type="text/javascript">
	jindo.TransitionSlider = jindo.$Class({
		$init : function() {
			var self = this;
			this.oTransition = new jindo.Transition().fps(50);
			this.getDragArea().attach("dragStart", function(){
				self.oTransition.abort();
			});
		},
		
		_setPosition : function(nIndex, nPos) {
			this._aPoses[nIndex] = nPos;
			var ht = {};
			ht["@" + this._htSwap.left] = jindo.Effect.easeOut(nPos + 'px');
			this.oTransition.abort().start(300, this._aThumbs[nIndex], ht);
		}
	}).extend(jindo.Slider);

	var oSlider = new jindo.TransitionSlider(jindo.$('beta'), { 
		nMinValue : 100, 
		nMaxValue : 500 
	}).attach({
		beforeChange : function(oCustomEvent) {
			if (oCustomEvent.nPos < 30) oCustomEvent.nPos = oCustomEvent.nPos < 15 ? 0 : 30;
			if (oCustomEvent.nPos > 170) oCustomEvent.nPos = oCustomEvent.nPos > 185 ? 200 : 170;
			oCustomEvent.nPos = Math.round(oCustomEvent.nPos / 10) * 10;
		}
	});
</script>
<script type="text/javascript" src="../asset/demojs/demo.js#footer"></script>
</body>
</html>